import  React from "react";
import '../css/content.css'
import eventEmitter from '../event'

class Content extends React.Component{
    constructor(props){
        super(props);
        this.state={
            list:[]
        }
    }
    componentDidMount(){
        eventEmitter.addListener("content",(message)=>{
        console.log(message)
        this.state.list.push(message);
        this.setState({
            message:this.state.messages
        })
        })
    }
    render(){
        return(
            <div className='content_border'>
                     {
                         this.state.list.map((element,index)=>{
                            return <div className="content_show">
                               <h3>{element.content}</h3> 
                            <h3>{element.data}</h3>
                            </div>
                         })
                     }                                                                                                                                                                                                   
            </div>
        )
    }
} 

export default Content